
srcdir=.

top_srcdir=/home/cotin/share/unimrcp-deps-1.5.0/libs/apr
top_blddir=/home/cotin/share/unimrcp-deps-1.5.0/libs/apr

#
# APR (Apache Portable Runtime) library Makefile.
#
CPP = gcc -E

# get substituted into some targets
APR_MAJOR_VERSION=1

#
# Macros for supporting directories
#
INCDIR=./include
OSDIR=$(top_srcdir)/include/arch/unix
DEFOSDIR=$(INCDIR)/arch/unix
INCLUDES=-I$(INCDIR) -I$(OSDIR) -I$(DEFOSDIR) -I$(top_srcdir)/include/arch/unix -I$(top_srcdir)/include -I$(top_srcdir)/include/private

#
# Macros for target determination
#
CLEAN_SUBDIRS= test
INSTALL_SUBDIRS=none

TARGET_LIB = libapr-${APR_MAJOR_VERSION}.la
APR_PCFILE = apr-$(APR_MAJOR_VERSION).pc
APR_CONFIG = apr-$(APR_MAJOR_VERSION)-config
INSTALL = /bin/install -c
INSTALL_DATA = ${INSTALL} -m 644

#
# Rules for building specific targets, starting with 'all' for
# building the entire package.
#
TARGETS = $(TARGET_LIB) apr.exp apr-config.out build/apr_rules.out

LT_VERSION = -version-info 5:2:5

# bring in rules.mk for standard functionality
include /home/cotin/share/unimrcp-deps-1.5.0/libs/apr/build/apr_rules.mk
include /home/cotin/share/unimrcp-deps-1.5.0/libs/apr/build-outputs.mk

CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \
	build/apr_rules.out tools/gen_test_char \
	tools/gen_test_char.o tools/gen_test_char.lo
DISTCLEAN_TARGETS = config.cache config.log config.status \
	include/apr.h include/arch/unix/apr_private.h \
	libtool $(APR_CONFIG) build/apr_rules.mk apr.pc \
	build/pkg/pkginfo
EXTRACLEAN_TARGETS = configure aclocal.m4 include/arch/unix/apr_private.h.in \
	build-outputs.mk build/ltcf-c.sh build/aclocal.m4 \
	build/ltconfig build/ltmain.sh \
	build/argz.m4 build/libtool.m4 build/ltoptions.m4 \
	build/ltsugar.m4 build/ltversion.m4 build/lt~obsolete.m4

prefix=/usr/local/apr
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
includedir=${prefix}/include/apr-${APR_MAJOR_VERSION}
installbuilddir=${prefix}/build-1

# Create apr-config script suitable for the install tree
apr-config.out: $(APR_CONFIG)
	sed 's,^\(location=\).*$$,\1installed,' < $(APR_CONFIG) > $@

# Create apr_rules.mk suitable for the install tree
build/apr_rules.out: build/apr_rules.mk
	sed -e 's,^\(apr_build.*=\).*$$,\1$(installbuilddir),' -e 's,^\(top_build.*=\).*$$,\1$(installbuilddir),' < build/apr_rules.mk > $@

install: $(TARGETS)
	$(APR_MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(installbuilddir) \
		     $(DESTDIR)$(libdir)/pkgconfig $(DESTDIR)$(includedir)
	$(INSTALL_DATA) $(top_blddir)/include/apr.h $(DESTDIR)$(includedir)
	for f in $(top_srcdir)/include/apr_*.h; do \
	    $(INSTALL_DATA) $${f} $(DESTDIR)$(includedir); \
	done
	$(LIBTOOL) --mode=install $(INSTALL) -m 755 $(TARGET_LIB) $(DESTDIR)$(libdir)
	$(INSTALL_DATA) apr.exp $(DESTDIR)$(libdir)/apr.exp
	$(INSTALL_DATA) apr.pc $(DESTDIR)$(libdir)/pkgconfig/$(APR_PCFILE)
	for f in libtool shlibtool; do \
	    if test -f $${f}; then $(INSTALL) -m 755 $${f} $(DESTDIR)$(installbuilddir); fi; \
	done
	$(INSTALL) -m 755 $(top_srcdir)/build/mkdir.sh $(DESTDIR)$(installbuilddir)
	for f in make_exports.awk make_var_export.awk; do \
	    $(INSTALL_DATA) $(top_srcdir)/build/$${f} $(DESTDIR)$(installbuilddir); \
	done
	$(INSTALL_DATA) build/apr_rules.out $(DESTDIR)$(installbuilddir)/apr_rules.mk
	$(INSTALL) -m 755 apr-config.out $(DESTDIR)$(bindir)/$(APR_CONFIG)
	@if [ $(INSTALL_SUBDIRS) != "none" ]; then \
            for i in $(INSTALL_SUBDIRS); do \
	        ( cd $$i ; $(MAKE) DESTDIR=$(DESTDIR) install ); \
	    done \
	fi

$(TARGET_LIB): $(OBJECTS)
	$(LINK) -rpath $(libdir) $(OBJECTS) $(ALL_LIBS)

exports.c: $(HEADERS)
	$(APR_MKEXPORT) $(HEADERS) > $@

export_vars.c: $(HEADERS)
	$(APR_MKVAREXPORT) $(HEADERS) > $@

apr.exp: exports.c export_vars.c
	@echo "#! libapr-${APR_MAJOR_VERSION}.so" > $@
	@echo "* This file was AUTOGENERATED at build time." >> $@
	@echo "* Please do not edit by hand." >> $@
	$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/' >> $@
	$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$$/d' >> $@

dox:
	doxygen $(top_srcdir)/docs/doxygen.conf

gcov: 
	@build/run-gcov.sh

test: check
check: $(TARGET_LIB)
	cd test && $(MAKE) all check

etags:
	etags `find . -name '*.[ch]'`

OBJECTS_gen_test_char = tools/gen_test_char.lo $(LOCAL_LIBS)
tools/gen_test_char.lo: tools/gen_test_char.c
	$(APR_MKDIR) tools
	$(LT_COMPILE)

tools/gen_test_char: $(OBJECTS_gen_test_char)
	$(LINK_PROG) $(OBJECTS_gen_test_char) $(ALL_LIBS)

LINK_PROG = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LT_LDFLAGS) \
	    -no-install $(ALL_LDFLAGS) -o $@

# DO NOT REMOVE
docs: $(INCDIR)/*.h
